﻿#pragma once
#include "afxwin.h"
#include "..\Cards\CardPL2318B.h"

// CPL2318BDlg 对话框

class CPL2318BDlg : public CDialogEx
{
	DECLARE_DYNAMIC(CPL2318BDlg)

public:
	CPL2318BDlg(CWnd* pParent = nullptr);   // 标准构造函数
	virtual ~CPL2318BDlg();

// 对话框数据
	enum { IDD = IDD_DIALOG_PL2318B };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()
protected:
	BOOL m_bRuning;

protected:
	void EnableCtrl(BOOL bEnable);
	void ShowAiChans(BOOL bShow);
	void SetAiChanVal(int nChanIndex, double dblVal);
	void SetDioChanType();
	void SetDioChanVal(int nChanIndex, BOOL bVal);
	BYTE GetDioCtrlVal(int nChanIndex);
	BOOL IsDiChan(int nChanIndex);

protected:
	CCardPL2318B   m_card;

protected:
	CEdit m_editAddress;
	CStatic m_lblCardNo;
	CButton m_btnStart;
	CStatic m_lblAI1;
	CStatic m_lblAI2;
	CStatic m_lblAI3;
	CStatic m_lblAI4;
	CStatic m_lblAI5;
	CStatic m_lblAI6;
	CStatic m_lblAI7;
	CStatic m_lblAI8;
	CStatic m_lblAI9;
	CStatic m_lblAI10;
	CStatic m_lblAI11;
	CStatic m_lblAI12;
	CStatic m_lblAI13;
	CStatic m_lblAI14;
	CStatic m_lblAI15;
	CStatic m_lblAI16;
	CButton m_btnGround;
	CButton m_btnRange;
	CEdit m_editAO1;
	CEdit m_editAO2;
	CEdit m_editAO3;
	CEdit m_editAO4;
	CButton m_btnAoRange;
	CComboBox m_didoMode;
	CButton m_btnD1;
	CButton m_btnD2;
	CButton m_btnD3;
	CButton m_btnD4;
	CButton m_btnD5;
	CButton m_btnD6;
	CButton m_btnD7;
	CButton m_btnD8;
	CButton m_btnD9;
	CButton m_btnD10;
	CButton m_btnD11;
	CButton m_btnD12;
	CButton m_btnD13;
	CButton m_btnD14;
	CButton m_btnD15;
	CButton m_btnD16;
	CButton m_btnD17;
	CButton m_btnD18;
	CButton m_btnD19;
	CButton m_btnD20;
	CButton m_btnD21;
	CButton m_btnD22;
	CButton m_btnD23;
	CButton m_btnD24;
	CStatic m_lblErrMsg;
public:
	afx_msg void OnBnClickedButtonStart();
	virtual BOOL OnInitDialog();
	afx_msg void OnBnClickedRadio1();
	afx_msg void OnBnClickedRadio2();
	afx_msg void OnCbnSelchangeComboDidoMode();
	afx_msg void OnBnClickedRadio(UINT nID);
	afx_msg void OnTimer(UINT_PTR nIDEvent);
};
